using System;
using System.Collections;

public static class DataCenterService
{
	static DataCenter mDataCenter;
	
	public static void Initialize()
	{
		mDataCenter = new DataCenter();
	}
	
	public static void Write(string key, Object value)
	{
		mDataCenter.Write(key, value);
	}
	
	public static void Remove(string key)
	{
		mDataCenter.Remove(key);
	}
	
	public static void AddListener(string key, DataCenterHandler handler)
	{
		mDataCenter.AddListener(key, handler);
	}
	
	public static void RemoveListener(string key, DataCenterHandler handler)
	{
		mDataCenter.RemoveListener(key, handler);
	}
	
	// scene -> stage -> global
	public static T Read<T>(string key)
	{
		T value = default(T);
		
		if (value == null)
			value = (T)mDataCenter.Read<T>(key);
		
		return value;
	}
}